#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Project: spd-sxmcc
"""
@author: lyndon
@time Created on 2019/3/6 12:05
@desc
"""
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker, scoped_session
from sqlalchemy.pool import NullPool


url = 'mysql://root:newpasswd@192.168.100.161:3306/mysql'
database = "CRTDB"

engine = create_engine(url, convert_unicode=True, pool_recycle=300, poolclass=NullPool)
SessionFactory = sessionmaker(bind=engine)

hasTable = engine.has_table('BusinessPartner', 'OLINGO')
print(hasTable)
tables = engine.table_names('OLINGO')
print(tables)

# session = scoped_session(SessionFactory)
# print(session.__dict__)
# session.execute("create database if not exists %s" % database)
# hasTable = session.dialect.has_table('BusinessPartner', 'OLINGO')
# print(hasTable)
# b = input('>>>')
# session.execute("commit")  # 可以
# session.commit()
# session.remove()
a = input('>>>')

